package com.kexio.enterprise.integration.message.domain;

import com.kexio.enterprise.integration.message.enums.MessagePriority;
import com.kexio.enterprise.integration.message.enums.MessageType;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * 消息基础类
 * 
 * @author Kexio
 * @since 1.0.0
 */
public class Message {
    private String messageId;
    private MessageType type;
    private MessagePriority priority;
    private String sender;
    private List<String> recipients;
    private String subject;
    private String content;
    private String contentType; // text/plain, text/html
    private Map<String, Object> attachments;
    private Map<String, String> headers;
    private Map<String, Object> metadata;
    private LocalDateTime createTime;
    private LocalDateTime expireTime;
    private int maxRetryCount;
    private int retryInterval; // 秒

    public Message() {
        this.messageId = java.util.UUID.randomUUID().toString();
        this.priority = MessagePriority.NORMAL;
        this.createTime = LocalDateTime.now();
        this.maxRetryCount = 3;
        this.retryInterval = 30;
        this.contentType = "text/plain";
    }

    // Getters and Setters
    public String getMessageId() { return messageId; }
    public void setMessageId(String messageId) { this.messageId = messageId; }
    
    public MessageType getType() { return type; }
    public void setType(MessageType type) { this.type = type; }
    
    public MessagePriority getPriority() { return priority; }
    public void setPriority(MessagePriority priority) { this.priority = priority; }
    
    public String getSender() { return sender; }
    public void setSender(String sender) { this.sender = sender; }
    
    public List<String> getRecipients() { return recipients; }
    public void setRecipients(List<String> recipients) { this.recipients = recipients; }
    
    public String getSubject() { return subject; }
    public void setSubject(String subject) { this.subject = subject; }
    
    public String getContent() { return content; }
    public void setContent(String content) { this.content = content; }
    
    public String getContentType() { return contentType; }
    public void setContentType(String contentType) { this.contentType = contentType; }
    
    public Map<String, Object> getAttachments() { return attachments; }
    public void setAttachments(Map<String, Object> attachments) { this.attachments = attachments; }
    
    public Map<String, String> getHeaders() { return headers; }
    public void setHeaders(Map<String, String> headers) { this.headers = headers; }
    
    public Map<String, Object> getMetadata() { return metadata; }
    public void setMetadata(Map<String, Object> metadata) { this.metadata = metadata; }
    
    public LocalDateTime getCreateTime() { return createTime; }
    public void setCreateTime(LocalDateTime createTime) { this.createTime = createTime; }
    
    public LocalDateTime getExpireTime() { return expireTime; }
    public void setExpireTime(LocalDateTime expireTime) { this.expireTime = expireTime; }
    
    public int getMaxRetryCount() { return maxRetryCount; }
    public void setMaxRetryCount(int maxRetryCount) { this.maxRetryCount = maxRetryCount; }
    
    public int getRetryInterval() { return retryInterval; }
    public void setRetryInterval(int retryInterval) { this.retryInterval = retryInterval; }
}
